package com.qf.service.impl;

import com.qf.entity.TInst;
import com.qf.events.InstEvent;
import com.qf.mapper.InstMapper;
import com.qf.service.InstService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/*
杨威
2021/11/6
16:13
*/
@Service
@Transactional
public class InstServiceImpl implements InstService {
    @Autowired
    InstMapper instMapper;
    @Autowired
    ApplicationContext context;
    @Override
    public int add(TInst tInst) {
        int insert = instMapper.insert(tInst);
        context.publishEvent(InstEvent.class);
        return insert;
    }

    @Override
    public int delete(Long id) {
        int delete = instMapper.delete(id);
        context.publishEvent(InstEvent.class);
        return delete;
    }

    @Override
    public int update(TInst tInst) {
        int update = instMapper.update(tInst);
        context.publishEvent(InstEvent.class);
        return update;
    }
}
